home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / error_hn / mcbundle / 3dmeter / t2w_3dm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-30  |  9.5 KB  |  322 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "TIME2WIN : 3D Meter"
  5.    ClientHeight    =   4245
  6.    ClientLeft      =   945
  7.    ClientTop       =   1365
  8.    ClientWidth     =   6045
  9.    Height          =   4590
  10.    Left            =   915
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4245
  13.    ScaleWidth      =   6045
  14.    Top             =   1050
  15.    Width           =   6105
  16.    Begin ComboBox Combo1 
  17.       BackColor       =   &H00C0C0C0&
  18.       FontBold        =   0   'False
  19.       FontItalic      =   0   'False
  20.       FontName        =   "MS Sans Serif"
  21.       FontSize        =   8.25
  22.       FontStrikethru  =   0   'False
  23.       FontUnderline   =   0   'False
  24.       Height          =   300
  25.       Left            =   2520
  26.       TabIndex        =   15
  27.       Top             =   2250
  28.       Width           =   2265
  29.    End
  30.    Begin CommandButton Command5 
  31.       Caption         =   "&Random value"
  32.       Height          =   465
  33.       Left            =   2520
  34.       TabIndex        =   4
  35.       Top             =   1260
  36.       Width           =   2265
  37.    End
  38.    Begin Frame Frame1 
  39.       BackColor       =   &H00C0C0C0&
  40.       Caption         =   "&Form"
  41.       Height          =   1815
  42.       Left            =   90
  43.       TabIndex        =   10
  44.       Top             =   1170
  45.       Width           =   2355
  46.       Begin OptionButton Option1 
  47.          BackColor       =   &H00C0C0C0&
  48.          Caption         =   "&Bar"
  49.          Height          =   225
  50.          Index           =   4
  51.          Left            =   180
  52.          TabIndex        =   9
  53.          Top             =   1440
  54.          Width           =   1905
  55.       End
  56.       Begin OptionButton Option1 
  57.          BackColor       =   &H00C0C0C0&
  58.          Caption         =   "&Ellipse"
  59.          Height          =   225
  60.          Index           =   3
  61.          Left            =   180
  62.          TabIndex        =   8
  63.          Top             =   1170
  64.          Width           =   1905
  65.       End
  66.       Begin OptionButton Option1 
  67.          BackColor       =   &H00C0C0C0&
  68.          Caption         =   "&Trapezium"
  69.          Height          =   225
  70.          Index           =   2
  71.          Left            =   180
  72.          TabIndex        =   7
  73.          Top             =   900
  74.          Width           =   1905
  75.       End
  76.       Begin OptionButton Option1 
  77.          BackColor       =   &H00C0C0C0&
  78.          Caption         =   "&Triangle"
  79.          Height          =   225
  80.          Index           =   1
  81.          Left            =   180
  82.          TabIndex        =   6
  83.          Top             =   630
  84.          Width           =   1905
  85.       End
  86.       Begin OptionButton Option1 
  87.          BackColor       =   &H00C0C0C0&
  88.          Caption         =   "&Rectangle"
  89.          Height          =   225
  90.          Index           =   0
  91.          Left            =   180
  92.          TabIndex        =   5
  93.          Top             =   360
  94.          Value           =   -1  'True
  95.          Width           =   1905
  96.       End
  97.    End
  98.    Begin CheckBox Check1 
  99.       BackColor       =   &H00C0C0C0&
  100.       Caption         =   "Swap &Border"
  101.       Height          =   285
  102.       Left            =   2520
  103.       TabIndex        =   11
  104.       Top             =   1800
  105.       Width           =   2265
  106.    End
  107.    Begin HScrollBar HScroll1 
  108.       Height          =   285
  109.       LargeChange     =   100
  110.       Left            =   2520
  111.       SmallChange     =   25
  112.       TabIndex        =   12
  113.       Top             =   2700
  114.       Width           =   2265
  115.    End
  116.    Begin PictureBox Picture2 
  117.       BackColor       =   &H00FFFFFF&
  118.       Height          =   4050
  119.       Left            =   4860
  120.       ScaleHeight     =   4020
  121.       ScaleWidth      =   1050
  122.       TabIndex        =   14
  123.       TabStop         =   0   'False
  124.       Top             =   90
  125.       Width           =   1080
  126.    End
  127.    Begin PictureBox Picture1 
  128.       BackColor       =   &H00FFFFFF&
  129.       Height          =   1080
  130.       Left            =   180
  131.       ScaleHeight     =   1050
  132.       ScaleWidth      =   4575
  133.       TabIndex        =   13
  134.       TabStop         =   0   'False
  135.       Top             =   3060
  136.       Width           =   4605
  137.    End
  138.    Begin CommandButton Command4 
  139.       Caption         =   "Swap &Horizontal/Vertical"
  140.       Height          =   465
  141.       Left            =   90
  142.       TabIndex        =   1
  143.       Top             =   630
  144.       Width           =   2355
  145.    End
  146.    Begin CommandButton Command3 
  147.       Caption         =   "Automatic &Decrease"
  148.       Height          =   465
  149.       Left            =   2520
  150.       TabIndex        =   3
  151.       Top             =   630
  152.       Width           =   2265
  153.    End
  154.    Begin CommandButton Command2 
  155.       Caption         =   "Automatic &Increase"
  156.       Height          =   465
  157.       Left            =   2520
  158.       TabIndex        =   2
  159.       Top             =   90
  160.       Width           =   2265
  161.    End
  162.    Begin CommandButton Command1 
  163.       Caption         =   "Half of Current &Value"
  164.       Height          =   465
  165.       Left            =   90
  166.       TabIndex        =   0
  167.       Top             =   90
  168.       Width           =   2355
  169.    End
  170. Option Explicit
  171. Dim LoadFinish    As Integer
  172. Dim Meter1        As tag3DMeter
  173. Dim Meter2        As tag3DMeter
  174. Sub Check1_Click ()
  175.    'swap the border style
  176.    If (Picture1.BorderStyle = 1) Then
  177.       Picture1.BorderStyle = 0
  178.    Else
  179.       Picture1.BorderStyle = 1
  180.    End If
  181.    If (Picture2.BorderStyle = 1) Then
  182.       Picture2.BorderStyle = 0
  183.    Else
  184.       Picture2.BorderStyle = 1
  185.    End If
  186.    Call Update3DMeter
  187. End Sub
  188. Sub Combo1_Click ()
  189.    If (LoadFinish = True) Then
  190.       ' update the brush style
  191.       Meter1.HatchBrush = Combo1.ListIndex
  192.       Meter2.HatchBrush = Combo1.ListIndex
  193.       Call Update3DMeter
  194.    End If
  195. End Sub
  196. Sub Command1_Click ()
  197.    ' calculate the half value and refresh
  198.    Meter1.CrtValue = Meter1.CrtValue / 2
  199.    ' calculate the half value and refresh
  200.    Meter2.CrtValue = Meter2.CrtValue / 2
  201.    ' refresh the scroll bar
  202.    HScroll1.Value = Meter1.CrtValue
  203.    Call Update3DMeter
  204. End Sub
  205. Sub Command2_Click ()
  206.    Dim i As Integer
  207.    ' automatic increase
  208.    For i = Meter1.CrtValue To Meter1.MaxValue
  209.       Meter1.CrtValue = i
  210.       Meter2.CrtValue = i
  211.       Call Update3DMeter
  212.    Next i
  213.    ' refresh the scroll bar
  214.    HScroll1.Value = Meter1.CrtValue
  215. End Sub
  216. Sub Command3_Click ()
  217.    Dim i As Integer
  218.    ' automatic decrease
  219.    For i = Meter1.CrtValue To 0 Step -1
  220.       Meter1.CrtValue = i
  221.       Meter2.CrtValue = i
  222.       Call Update3DMeter
  223.    Next i
  224.    ' refresh the scroll bar
  225.    HScroll1.Value = Meter1.CrtValue
  226. End Sub
  227. Sub Command4_Click ()
  228.    ' swap the direction and refresh
  229.    Meter1.Direction = Not Meter1.Direction
  230.    ' swap the direction and refresh
  231.    Meter2.Direction = Not Meter2.Direction
  232.    ' refresh the scroll bar
  233.    HScroll1.Value = Meter1.CrtValue
  234.    Call Update3DMeter
  235. End Sub
  236. Sub Command5_Click ()
  237.    Dim i As Integer
  238.    Randomize Timer
  239.    ' automatic decrease
  240.    For i = 1 To 50
  241.       Meter1.CrtValue = Meter1.MaxValue * Rnd(1)
  242.       Meter2.CrtValue = Meter2.MaxValue * Rnd(1)
  243.       Call Update3DMeter
  244.    Next i
  245.    ' refresh the scroll bar
  246.    HScroll1.Value = Meter1.CrtValue
  247. End Sub
  248. Sub Form_Load ()
  249.    ' some initialization
  250.    LoadFinish = False
  251.    ' initialize the random generator
  252.    Randomize Timer
  253.    ' initialize the combo box
  254.    Combo1.AddItem "Solid brush"
  255.    Combo1.AddItem "Horizontal"
  256.    Combo1.AddItem "Vertical"
  257.    Combo1.AddItem "Downward diagonal"
  258.    Combo1.AddItem "Upward diagonal"
  259.    Combo1.AddItem "Cross"
  260.    Combo1.AddItem "Diagonal cross"
  261.    Combo1.ListIndex = 0
  262.    ' initialize the first 3D-Meter
  263.    Meter1.MaxValue = 100
  264.    Meter1.CrtValue = Meter1.MaxValue / 2
  265.    Meter1.BackColor = &HC0C0C0
  266.    Meter1.ForeColor = &H808080
  267.    Meter1.Polygon = 0
  268.    Meter1.BarSize = 7      'default = 10
  269.    Meter1.SpaceBars = 0    'default = 2
  270.    Meter1.Direction = 0
  271.    Meter1.Thickness = 0
  272.    Meter1.ThreeD = -1
  273.    Meter1.HatchBrush = Combo1.ListIndex
  274.    ' initialize the second 3D-Meter
  275.    Call cTypesCopy(Meter1, Meter2, Len(Meter1))
  276.    Meter2.Direction = Not Meter1.Direction
  277.    Meter1.ThreeD = 1
  278.    ' initialize the scroll bar
  279.    HScroll1.LargeChange = Meter1.MaxValue / 10
  280.    HScroll1.SmallChange = Meter1.MaxValue / 20
  281.    HScroll1.Max = Meter1.MaxValue
  282.    HScroll1.Value = Meter1.MaxValue / 2
  283.    ' initialize backcolor of picture
  284.    Picture1.BackColor = Meter1.BackColor
  285.    Picture2.BackColor = Meter2.BackColor
  286.    LoadFinish = True
  287. End Sub
  288. Sub Form_Paint ()
  289.    Call Update3DMeter
  290.    ' refresh some 3D controls
  291.    c3D HScroll1, 0, 0
  292.    c3D Check1, 0, 0
  293.    c3D Option1(0), 0, 0
  294.    c3D Option1(1), 0, 0
  295.    c3D Option1(2), 0, 0
  296.    c3D Option1(3), 0, 0
  297.    c3D Option1(4), 0, 0
  298. End Sub
  299. Sub HScroll1_Change ()
  300.    Call Update3DMeterScrollBar
  301. End Sub
  302. Sub HScroll1_Scroll ()
  303.    Call Update3DMeterScrollBar
  304. End Sub
  305. Sub Option1_Click (Index As Integer)
  306.    ' set the form of the 3D Meter
  307.    Meter1.Polygon = Index
  308.    Meter2.Polygon = Index
  309.    Call Update3DMeter
  310. End Sub
  311. Sub Update3DMeter ()
  312.    ' refresh the 3D-Meter
  313.    Call c3DMeter(Picture1, Meter1)
  314.    Call c3DMeter(Picture2, Meter2)
  315. End Sub
  316. Sub Update3DMeterScrollBar ()
  317.    ' update current value
  318.    Meter1.CrtValue = HScroll1.Value
  319.    Meter2.CrtValue = HScroll1.Value
  320.    Call Update3DMeter
  321. End Sub
  322.